package com.zhang.remoteapi.feign.fallbackfactory;

import com.zhang.common.core.constant.ResultConstant;
import com.zhang.common.core.vo.Result;
import com.zhang.remoteapi.feign.AdminServiceFeign;
import com.zhang.remoteapi.feign.fallbackImpl.AdminServiceFeignFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author zsw
 * @Date 2019/11/8 9:32
 * @Version V1.0
 **/
@Component
public class AdminServiceFeignFallbackFactory implements FallbackFactory<AdminServiceFeign> {


    @Override
    public AdminServiceFeign create(Throwable cause) {
        Result result = new Result(ResultConstant.EX_INTERFACE,"远程调用接口异常");
        AdminServiceFeignFallbackImpl adminServiceFeignFallback = new AdminServiceFeignFallbackImpl();
        adminServiceFeignFallback.setResult(result);
        adminServiceFeignFallback.setCause(cause);
        return adminServiceFeignFallback;


    }
}